/**
 * Desenvolvido pela Fábrica de Software do CESUPA.
 * Todos os direitos reservados.
 */
package br.cesupa.fabsoft.nomedoprojeto.utils;

import java.io.File;
import javax.faces.context.FacesContext;
import javax.servlet.ServletContext;

/**
 *
 * @author Breno Leite
 */
public class ApplicationTools {

    public static String getApplicationDirectory() {

        FacesContext facesContext = FacesContext.getCurrentInstance();
        ServletContext servletContext =
                (ServletContext) facesContext.getExternalContext().getContext();

        return servletContext.getRealPath("");
    }

    public static String getDirectoryInApplication(String directory) {

        FacesContext facesContext = FacesContext.getCurrentInstance();
        ServletContext servletContext =
                (ServletContext) facesContext.getExternalContext().getContext();

        return servletContext.getRealPath(File.separator + directory);
    }
}
